package cn.tedu.sp06;

import org.springframework.boot.SpringApplication;

import org.springframework.cloud.client.SpringCloudApplication;

import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;

import org.springframework.context.annotation.Bean;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@SpringCloudApplication
public class Sp07hystrixApplication {
    @LoadBalanced
    @Bean
    public RestTemplate restTemplate(){
        SimpleClientHttpRequestFactory f =new SimpleClientHttpRequestFactory();
        //连接超时
        f.setConnectTimeout(1000);
        //读取超时
        f.setReadTimeout(1000);
        return new RestTemplate(f);
    }
    public static void main(String[] args) {
        SpringApplication.run(Sp07hystrixApplication.class, args);
    }

}
